<?php
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
header('Content-Type: text/xml');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");

if (is_array($aAuditData) || is_array($aIncident))
{
    echo '<?xml version="1.0" encoding="UTF-8"?>
<data>';

    if (is_array($aAuditData))
    {
        foreach ($aAuditData as $aRow)
        {
    
            preg_match("/.*?::(.*)/", $aRow["action"], $aMatches);
            $sAction = $aMatches[1];
            $sTitle = $aRow["username"]." ".substr($aRow["comment"], 0, 15)."...";
            if (strlen($aRow["comment"]) > 255)
            {
                $sComments = substr($aRow["comment"], 0, 255)."...";
            }
            else
            {
                $sComments = $aRow["comment"];
            }
        ?>            
            <event 
                start="<?=get_time_str(strtotime($aRow["modifiedDate"]), "timeline");?>"
                title="<?=$sTitle;?>"
            >
            Action By <?=$aRow["username"];?>. <?=$sComments;?>. 
            </event>
            <?
        }
    }
    
    if (is_array($aIncident))
    {
        foreach ($aIncident as $aRow)
        {
    
        ?>            
            <event 
                start="<?=get_time_str($aRow["incidentStart"], "timeline");?>"
                title="<?=$aRow["title"];?>"
            >
            <?=$aRow["description"];?>
            </event>
            <?
        }
    }
    echo "</data>";
}

?>
